package com.ycg.blog.config;

import com.algolia.search.DefaultSearchClient;
import com.algolia.search.SearchClient;
import com.algolia.search.SearchIndex;
import com.ycg.blog.pojo.Article;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author YCG
 * @date 2024-03-15 18:36
 * @description algolia配置
 */
@Configuration
public class AlgoliaConfig {

    @Value("${algolia.application-id}")
    private String applicationID;

    @Value("${algolia.api-key}")
    private String apiKey;

    @Bean
    public SearchClient searchClient() {
        // Connect and authenticate with your Algolia app
        return DefaultSearchClient.create(applicationID, apiKey);
    }
}
